package com.mininglamp.utils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import org.apache.tomcat.jdbc.pool.ConnectionPool;
import org.apache.tomcat.jdbc.pool.DataSource;
import org.springframework.beans.factory.annotation.Autowired;

public class PageInquire {

	@Autowired
	DataSource dataSource;

	public ResultSet findPage(String sql) {

		ConnectionPool pool = dataSource.getPool();
		Connection conn = null;
		ResultSet rs = null;
		try {
			System.out.println(pool.getActive());
			conn = pool.getConnection();
			System.out.println(pool.getActive());
			System.out.println(conn);
			// String sql1="select * from jwt_check_person_log_1501";
			PreparedStatement ps = conn.prepareStatement(sql);
			rs = ps.executeQuery();
			/*
			 * System.out.println(rs.toString()); while (rs.next()) {
			 * System.out.println(rs.getString("pcode")); //
			 * pageHelper.setResult(rs.get); }
			 */

			conn.close();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (conn != null) {
				conn = null;
			}

		}
		return rs;
	}
}
